﻿CREATE TABLE [dbo].[Sanctions]
(
	[SanctionID] INT NOT NULL PRIMARY KEY, 
    [SanctionName] NCHAR(10) NULL, 
    [SchoolYearID] INT NOT NULL, 
    [ClassID] INT NOT NULL, 
    [StudentID] NCHAR(20) NOT NULL, 
    [SubjectID] INT NULL, 
    [ViolationID] INT NOT NULL, 
    [DateViolation] DATETIME NULL, 
    [StateSend] BIT NULL, 
    [StateMessage] BIT NULL, 
    [Number] INT NULL,
	CONSTRAINT FK_Sanctions_Subjects FOREIGN KEY (SubjectID) 
    REFERENCES Subjects (SubjectID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_Sanctions_Students FOREIGN KEY (StudentID) 
    REFERENCES Students (StudentID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_Sanctions_Classes FOREIGN KEY (ClassID) 
    REFERENCES Classes (ClassID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_Sanctions_SchoolYears FOREIGN KEY (SchoolYearID) 
    REFERENCES SchoolYears (SchoolYearID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE,
	CONSTRAINT FK_Sanctions_Violations FOREIGN KEY (ViolationID) 
    REFERENCES Violations (ViolationID) 
    ON DELETE CASCADE
    ON UPDATE CASCADE
)
